let userinfo = localStorage.userinfo===undefined?'':JSON.parse(localStorage.userinfo);

const state = {
  name: '',
  actor: '',
  id: '',
  status: '',
}

try {
  if (userinfo.actor) {
    state.actor = userinfo.actor
  }
} catch (e) {
}
try {
  if (userinfo.id) {
    state.id = userinfo.id
  }
} catch (e) {
}
try {
  if (userinfo.status) {
    state.status = userinfo.status
  }
} catch (e) {
}
try {
  if (userinfo.name) {
    state.name = userinfo.name
  }
} catch (e) {
}

const mutations = {
  saveuserinfo: (state, payload) => {
    // state.username = payload.username;
    state.actor = payload.actor;
    state.id = payload.id;
    state.status = payload.status;
    state.name = payload.name;
  }
}
export default {
  state,
  mutations
}
